/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cassys.action.authentication;

import cassys.domain.userManagement.User;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;



public class AuthenticateAction  {

//    protected HttpServletRequest request;
//    protected Map<String, Object> session;
//
//    public void setServletRequest(HttpServletRequest httpServletRequest) {
//		this.request = httpServletRequest;
//    }
//
//    public void setSession(Map<String, Object> session) {
//		this.session = session;
//    } {
//
//    private UserManagerDelegate userManagerDelegate = new UserManagerDelegate();
//
//    private String username;
//    private String password;
//
//     public String execute() throws Exception {
//         return SUCCESS;
//     }
//
//     public String authenticate() throws Exception
//     {
//        System.out.println("AuthenticateAction is called.");
//
//        User user = null;
//        String result = "";
//
//        System.out.println("UserName: " + username + ", Password: " + password);
//        
//        user = userManagerDelegate.validateUser(username, password);
//        if(user == null)
//            return "FAIL";
//
//        if(user instanceof Student)
//            result = "STUDENT";
//        else if (user instanceof Lecture)
//            result = "LECTURE";
//        else if (user instanceof Admin)
//            System.out.println("Admin");
//
//        session.put(SurveyConstants.SESSION_USER, user);
//        System.out.println("AuthenticateAction - UserName: " + user.getName()
//                + ", Result: " + result);
//        
//        return result;
//     }
//
//     public String logout() throws Exception {
//		System.out.println("Inside Log Out Action after session invalidate");
//
//                request.getSession().invalidate();
//		return "SUCCESS";
//     }
//
//     public String getUsername() {
//            return username;
//    }
//
//    public void setUsername(String username) {
//            this.username = username;
//    }
//
//    public void setPassword(String password) {
//            this.password = password;
//    }
//
//    public String getPassword() {
//            return password;
//    }
}
